home *** CD-ROM | disk | FTP | other *** search
/ Champak 29 / Volume 29 - JOGO DISK .iso / Games / little_soldiers.swf / scripts / frame_25 / DoAction.as < prev   
Text File  |  2006-11-29  |  6KB  |  240 lines

  1. function remove1(force)
  2. {
  3.    if(force)
  4.    {
  5.       map[this.y][this.x] = 0;
  6.       smap[this.y][this.x] = 0;
  7.       addBoom(this.x,this.y,0);
  8.       this.removeMovieClip("");
  9.    }
  10. }
  11. function remove2(force)
  12. {
  13.    map[this.y][this.x] = 0;
  14.    smap[this.y][this.x] = 0;
  15.    addBoom(this.x,this.y,0);
  16.    this.removeMovieClip("");
  17. }
  18. function linker(num)
  19. {
  20.    num;
  21.    this.countdown = num++;
  22.    if(num % 4 == 0)
  23.    {
  24.       this.sp = true;
  25.    }
  26.    if(map[this.y][this.x + 1].t == 3 && map[this.y][this.x + 1].countdown == -1)
  27.    {
  28.       map[this.y][this.x + 1].linker(num);
  29.    }
  30.    if(map[this.y][this.x - 1].t == 3 && map[this.y][this.x - 1].countdown == -1)
  31.    {
  32.       map[this.y][this.x - 1].linker(num);
  33.    }
  34.    if(map[this.y + 1][this.x].t == 3 && map[this.y + 1][this.x].countdown == -1)
  35.    {
  36.       map[this.y + 1][this.x].linker(num);
  37.    }
  38.    if(map[this.y - 1][this.x].t == 3 && map[this.y - 1][this.x].countdown == -1)
  39.    {
  40.       map[this.y - 1][this.x].linker(num);
  41.    }
  42.    this.onEnterFrame = linkerDie;
  43. }
  44. function remove3(force)
  45. {
  46.    this.linker(1);
  47. }
  48. function frame3()
  49. {
  50.    if(this.countdown > 0)
  51.    {
  52.       return 1;
  53.    }
  54. }
  55. function linkerDie()
  56. {
  57.    if(this.countdown > 0)
  58.    {
  59.       this.countdown = this.countdown - 1;
  60.       if(this.countdown == 0)
  61.       {
  62.          if(this.sp || random(4) == 2)
  63.          {
  64.             var _loc3_ = soundBoard.newSound("sLinker");
  65.             _loc3_.stop();
  66.             if(sounds)
  67.             {
  68.                _loc3_.start(0,0);
  69.             }
  70.          }
  71.          var _loc2_ = fg.attachMovie("boomlinker","boom_" + this.y + "_" + this.x,w * h + this.y * w + this.x);
  72.          _loc2_._x = this.x * tw - tw / 2;
  73.          _loc2_._y = this.y * th - th / 2;
  74.          _loc2_.onEnterFrame = function()
  75.          {
  76.             if(this._currentframe == this._totalframes)
  77.             {
  78.                this.removeMovieClip("");
  79.             }
  80.          };
  81.          smap[this.y][this.x] = 0;
  82.          map[this.y][this.x] = 0;
  83.          this.removeMovieClip("");
  84.       }
  85.       return 1;
  86.    }
  87. }
  88. function remove4()
  89. {
  90.    map[this.y][this.x] = 0;
  91.    smap[this.y][this.x] = 0;
  92.    addBoom(this.x,this.y,1);
  93.    smap[this.y - 1][this.x].remove(true);
  94.    smap[this.y][this.x - 1].remove(true);
  95.    smap[this.y][this.x + 1].remove(true);
  96.    smap[this.y + 1][this.x].remove(true);
  97.    this.removeMovieClip("");
  98. }
  99. function frame5()
  100. {
  101.    if(map[this.y + 1][this.x] == 0)
  102.    {
  103.       if(smap[this.y + 1][this.x])
  104.       {
  105.          smap[this.y + 1][this.x].remove(false);
  106.       }
  107.       map[this.y][this.x] = 0;
  108.       smap[this.y][this.x] = 0;
  109.       map[this.y + 1][this.x] = this;
  110.       smap[this.y + 1][this.x] = this;
  111.       this.y = this.y + 1;
  112.       var _loc2_ = map[this.y + 1][this.x].t;
  113.       if(_loc2_ == 4 || _loc2_ == 7)
  114.       {
  115.          map[this.y + 1][this.x].remove(false);
  116.       }
  117.       this.onEnterFrame = function()
  118.       {
  119.          this._y += tw / 3;
  120.       };
  121.       return 1;
  122.    }
  123.    this.onEnterFrame = null;
  124. }
  125. function frame7()
  126. {
  127.    if(map[this.y + 1][this.x] == 0)
  128.    {
  129.       if(smap[this.y + 1][this.x])
  130.       {
  131.          smap[this.y + 1][this.x].remove(false);
  132.          return undefined;
  133.       }
  134.       map[this.y][this.x] = 0;
  135.       smap[this.y][this.x] = 0;
  136.       map[this.y + 1][this.x] = this;
  137.       smap[this.y + 1][this.x] = this;
  138.       this.y = this.y + 1;
  139.       soundBoard.start("sFall",0,0);
  140.       this.fall = true;
  141.       this.onEnterFrame = function()
  142.       {
  143.          this._y += tw / 3;
  144.       };
  145.       return 1;
  146.    }
  147.    if(this.fall)
  148.    {
  149.       this.remove(false);
  150.    }
  151.    this.onEnterFrame = null;
  152. }
  153. function frame9()
  154. {
  155.    if(map[this.y + 1][this.x] == 0)
  156.    {
  157.       if(smap[this.y + 1][this.x])
  158.       {
  159.          smap[this.y + 1][this.x].remove(false);
  160.       }
  161.       map[this.y][this.x] = 0;
  162.       smap[this.y][this.x] = 0;
  163.       map[this.y + 1][this.x] = this;
  164.       smap[this.y + 1][this.x] = this;
  165.       this.y = this.y + 1;
  166.       var _loc2_ = map[this.y + 1][this.x].t;
  167.       if(_loc2_ == 4 || _loc2_ == 7)
  168.       {
  169.          map[this.y + 1][this.x].remove(false);
  170.       }
  171.       if(random(2))
  172.       {
  173.          soundBoard.start("sFall",0,0);
  174.       }
  175.       this.onEnterFrame = function()
  176.       {
  177.          if(this._y < th * this.y - 1)
  178.          {
  179.             this._y += th / 3;
  180.          }
  181.       };
  182.       return 1;
  183.    }
  184.    if(map[this.y + 1][this.x + 1] == 0 && map[this.y][this.x + 1] == 0)
  185.    {
  186.       map[this.y][this.x] = 0;
  187.       smap[this.y][this.x] = 0;
  188.       map[this.y][this.x + 1] = this;
  189.       smap[this.y][this.x + 1] = this;
  190.       this.x = this.x + 1;
  191.       this.onEnterFrame = function()
  192.       {
  193.          if(this._x < tw * this.x - 1)
  194.          {
  195.             this._x += tw / 3;
  196.          }
  197.       };
  198.       return 32;
  199.    }
  200.    if(map[this.y + 1][this.x - 1] == 0 && map[this.y][this.x - 1] == 0)
  201.    {
  202.       map[this.y][this.x] = 0;
  203.       smap[this.y][this.x] = 0;
  204.       map[this.y][this.x - 1] = this;
  205.       smap[this.y][this.x - 1] = this;
  206.       this.x = this.x - 1;
  207.       this.onEnterFrame = function()
  208.       {
  209.          if(this._x > tw * this.x + 1)
  210.          {
  211.             this._x -= tw / 3;
  212.          }
  213.       };
  214.       return 1;
  215.    }
  216.    this.onEnterFrame = null;
  217. }
  218. sounds = true;
  219. remove5 = remove2;
  220. remove6 = remove2;
  221. remove7 = remove4;
  222. remove8 = function()
  223. {
  224.    smap[this.y][this.x] = 0;
  225.    addBoom(this.x,this.y,2);
  226.    smap[this.y - 1][this.x - 1].remove(true);
  227.    smap[this.y - 1][this.x].remove(true);
  228.    smap[this.y - 1][this.x + 1].remove(true);
  229.    smap[this.y][this.x - 1].remove(true);
  230.    smap[this.y][this.x + 1].remove(true);
  231.    smap[this.y + 1][this.x - 1].remove(true);
  232.    smap[this.y + 1][this.x].remove(true);
  233.    smap[this.y + 1][this.x + 1].remove(true);
  234.    this.removeMovieClip("");
  235. };
  236. remove9 = remove2;
  237. remove10 = remove2;
  238. frame10 = frame5;
  239. remove11 = remove2;
  240.